<?PHP
/**
 * Монитор АТС
 * Copyright (c) 2006-2010 "Линия 24" http://www.line24.ru
 * welcome@line24.ru
 *
 * Здесь может быть ваша реклама. Сделано на Macintosh.
 */

require_once 'inc/functions.inc.php';
$title = '&laquo;Линия 24&raquo; - АТС1';
$product = 'Монитор сервера телефонии';

$time_now = (date('G') >= 9)?date('G')+1:'0'.date('G')+1; 
$time_select = (isset($_POST['time_end']))?$_POST['time_end']:'now';
$time_end = ($time_select != 'now')?$time_select:$time_now; 
$today = date("d").'.'.date("m").'.'.date("Y");
if ($time_select == 'now') {
	$date_end = $today;
} else {
	$date_end = (isset($_POST['date_end']))?$_POST['date_end']:$today;
}
$range = (isset($_POST['range']))?$_POST['range']:'3hour'; 
$cmd_date_end = mysql_date($date_end);

$cmd = dirname(__FILE__)."/bin/graph.sh  -d db/rrd_db -s 'end-$range' -e '$cmd_date_end $time_end' > /dev/null";
exec($cmd);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?=$title?></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script src="js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script src="js/jquery/ui.datepicker-ru.js" type="text/javascript"></script>

<script type="text/javascript">
$(function(){
    $.datepicker.setDefaults(
          $.extend($.datepicker.regional["ru"])
    );
    $(".datepicker").datepicker({
      showAnim: "fadeIn",
      showOn: "both",
      buttonText: '',
      buttonImageOnly: true,
      buttonImage: 'img/calendar.png'
    });
});
</script>

</head>
<body>

<div id="wrapper">
    <div id="header">
    	<div id="control_bar">
	        <div id="control_left"><strong><?=$product?></strong></div>
			<form action="" method="post">
				<label>Дата:<input name="date_end" class="datepicker" type="text" size="10" value="<?=$date_end?>"/></label>
				<label>время:<select name="time_end"><?php echo hours_options($time_select)?></select></label>
				<label>интервал:<select name="range"><?php echo range_options($range)?></select></label>
				<input type="submit" value="Показать"/>
			</form>        	
			<div class="clearer"></div>
	    </div>
	    
    </div>
    <div id="middle">
        <div id="container">

<table class="charts">
	<tr>
		<td><img src="charts/1.png" alt="" /></td>
		<td><img src="charts/2.png" alt="" /></td>
	</tr>
	<tr>
		<td><img src="charts/3.png" alt="" /></td>
		<td><img src="charts/4.png" alt="" /></td>
	</tr>
	<tr>
		<td><img src="charts/5.png" alt="" /></td>
		<td><img src="charts/6.png" alt="" /></td>
	</tr>
</table>

            </div>
        </div>
    </div>
        
    <div id="footer">
          V1.0 &copy; 2010 <a href="http://www.line24.ru">ЗАО &laquo;Линия 24&raquo;</a>
    </div>

</body>
</html>